package CompleteFutureDemo;

import common.CalcTask;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class SubmitTest {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        Future<Double> future = executorService.submit(() -> new CalcTask().RunWithResult());
        System.out.println("主线程执行："+System.currentTimeMillis());
        System.out.println("future 执行结果："+future.get());
        executorService.shutdown();
        System.out.println("主线程结束："+System.currentTimeMillis());
    }
}
